﻿<UserControl x:Class="Bend.Settings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800" Initialized="ControlInitialized" IsVisibleChanged="Settings_IsVisibleChanged">    
    <UserControl.Resources>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid>
                            <ContentPresenter x:Name="ContentSite" 
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center"
                                ContentSource="Header"
                            />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="ContextMenu" Value="{x:Null}"/>
            <Setter Property="MinWidth" Value="0"/>
            <Setter Property="MinHeight" Value="20"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="CaretBrush" Value="Silver"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBoxBase}">
                        <Grid>
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                            <Grid x:Name="UnderlineNormal">
                                <Line StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" X2="1" Stretch="Fill" Stroke="Silver"/>
                                <Line StrokeThickness="5" X1="0" X2="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Stroke="Silver"/>
                                <Line StrokeThickness="5" X1="0" X2="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Stroke="Silver"/>
                            </Grid>
                            <Grid x:Name="UnderlineActive" Visibility="Collapsed">
                                <Line StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" X2="1" Stretch="Fill" Stroke="#19A2DE"/>
                                <Line StrokeThickness="5" X1="0" X2="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Stroke="#19A2DE"/>
                                <Line StrokeThickness="5" X1="0" X2="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Stroke="#19A2DE"/>
                            </Grid>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Opacity" Value="0.5"/>
                            </Trigger>
                            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                                <Setter TargetName="UnderlineNormal" Property="Visibility" Value="Collapsed" />
                                <Setter TargetName="UnderlineActive" Property="Visibility" Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <TabControl Name="SettingsTabs" Background="Transparent" FontFamily="Segoe UI" HorizontalAlignment="Stretch" Margin="0,38,0,0" VerticalAlignment="Stretch" BorderThickness="0" Padding="4" SelectionChanged="TabControl_SelectionChanged">
            <TabItem>
                <TabItem.Header>
                    <Label Foreground="WhiteSmoke" FontStretch="Normal" FontWeight="ExtraLight" FontFamily="Segoe UI" FontSize="18" Padding="62,5,10,5">Integration</Label>
                </TabItem.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="60" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="60" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="1" MaxWidth="800" Margin="0,10,0,0">
                    <TextBlock Foreground="Silver" Margin="0,25,0,10" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap">
                        Enable integration features. Adds a Bend file option to Windows Explorer context menu. Choosing this option will make a change to your Windows registry.
                        Remember to disable this integration before uninstalling Bend.
                    </TextBlock>
                    <WrapPanel Grid.Column="1" Margin="0,10,0,10" HorizontalAlignment="Right">
                            <Button x:Name="EnableContextMenuButton" Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" Click="EnableContextMenu_Click">ENABLE</Button>
                            <Button x:Name="DisableContextMenuButton" Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" Click="DisableContextMenu">DISABLE</Button>
                    </WrapPanel>
                    <TextBlock Foreground="Silver" Margin="0,10,0,10" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap">
                        Add the Bend Directory to user enviroment path. Makes it easier to launch bend from command
                        line.
                    </TextBlock>
                    <WrapPanel Grid.Column="1" Margin="0,10,0,10" HorizontalAlignment="Right">
                            <Button x:Name="AppendToPathButton" Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" Click="AppendToPath_Click">APPEND TO PATH</Button>
                    </WrapPanel>
                    <TextBlock Foreground="Silver" Margin="0,10,0,10" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap">
                        Bend automatically checks for updates once every 7 days. But, if you 
                        want the latest and greatest now - go ahead and give this button a push.
                    </TextBlock>
                    <Rectangle Height="3" Fill="#19A2DE" Width="125"  HorizontalAlignment="Right" Margin="0, 10, 10, 0" ClipToBounds="True">
                            <Rectangle.Clip>
                                <RectangleGeometry x:Name="ProgressBar" Rect="0,0,0,5">

                                </RectangleGeometry>
                            </Rectangle.Clip>
                        </Rectangle>
                    <WrapPanel Grid.Column="1" Margin="0,0,0,10" HorizontalAlignment="Right">
                        <Button x:Name="CheckForUpdatesButton" Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" Click="CheckForUpdates_Click">CHECK FOR UPDATES</Button>                        
                    </WrapPanel>                    
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    <Label Foreground="Gray" FontStretch="Normal" FontWeight="ExtraLight" FontFamily="Segoe UI" FontSize="18" Padding="10,5"> Options</Label>
                </TabItem.Header>
                <Grid Margin="0,0,0,50">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="60" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="60" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="1" MinWidth="170" Margin="0,10,0,0" HorizontalAlignment="Center">
                        <Label Margin="0,20,0,0" FontFamily="Segoe UI" Content="Text Indent" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>                        
                        <WrapPanel Margin="20,10,0,0" HorizontalAlignment="Center">
                            <TextBlock Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap">                                
                                <RadioButton GroupName="TextIndent" Name="TextUseTabs" VerticalAlignment="Center" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14">Tabs</RadioButton>
                                <RadioButton GroupName="TextIndent" Name="TextUseSpaces" VerticalAlignment="Center" Margin="20,0,0,0" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14">Spaces</RadioButton>                                                                                        
                            </TextBlock>
                        </WrapPanel>
                        <TextBlock HorizontalAlignment="Center" Foreground="Silver" Margin="23,5,0,0" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap">                                
                            Indent Size
                            <TextBox Name="TextIndent" Margin="5,0,0,-2" FontSize="12" Width="50" PreviewKeyDown="AllowOnlyDigits_PreviewKeyDown" TextAlignment="Center" />
                        </TextBlock>
                        <Label FontFamily="Segoe UI" Content="Text Formatting" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>
                        <StackPanel HorizontalAlignment="Center" Margin="20,10,0,0">
                            <CheckBox Name="TextFormatShowFormatting" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Show formatting</CheckBox>
                            <CheckBox Name="TextWordWrap" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Word wrap</CheckBox>
                            <CheckBox Name="PreserveIndent" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Preserve indent</CheckBox>
                        </StackPanel>
                        
                        <Label FontFamily="Segoe UI" Content="Font" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>
                        <StackPanel HorizontalAlignment="Center" Margin="0,10,0,0" Width="200">                            
                            <ComboBox x:Name="FontPicker" ItemsSource="{Binding Source={x:Static Member=Fonts.SystemFontFamilies}}" SelectedIndex="0" >
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <Label FontFamily="{Binding .}" Content="{Binding Source}" Height="20" Padding="2,0,0,0" VerticalContentAlignment="Center" HorizontalAlignment="Stretch"/>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Grid.Column="2" MinWidth="170" Margin="0,10,0,0" HorizontalAlignment="Center">
                        <Label FontFamily="Segoe UI" Content="General" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>
                        <StackPanel HorizontalAlignment="Center" Margin="20,10,0,0">                            
                            <CheckBox Name="SettingsPageAnimation" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Settings page animation</CheckBox>
                            <CheckBox Name="ShowStatusBar" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Status bar</CheckBox>
                            <CheckBox Name="SmoothScrolling" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Smooth scrolling</CheckBox>
                            <CheckBox Name="SyntaxHighlighting" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Syntax Highlighting</CheckBox>
                            <CheckBox Name="ReopenFilesOnStart" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Reopen files on start</CheckBox>
                            <CheckBox Name="Diagnostics" Padding="10,0" Margin="5" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" Foreground="Silver">Diagnostics</CheckBox>
                        </StackPanel>
                        <Label FontFamily="Segoe UI" Content="Theme" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>
                        <StackPanel HorizontalAlignment="Center" Margin="0,10,0,0" Width="200">
                            <ComboBox x:Name="ThemePicker" SelectedIndex="0" Height="24">                                
                            </ComboBox>
                        </StackPanel>
                    </StackPanel>   
                    <WrapPanel Grid.Column="2" Margin="0,0,0,-20" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                        <Button Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" Click="OptionsSave_Click">SAVE</Button>
                        <Button Padding="15,2" FontFamily="Segoe UI" FontWeight="Bold" FontSize="10" Margin="5,5,5,5" IsDefault="True" Focusable="True" TabIndex="0" IsTabStop="True" Click="OptionsCancel_Click">CANCEL</Button>
                    </WrapPanel>
                </Grid>
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    <Label Foreground="Gray" FontStretch="Normal" FontWeight="ExtraLight" FontFamily="Segoe UI" FontSize="18" Padding="10,5">About</Label>
                </TabItem.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="500" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="1" MaxWidth="800" Margin="0,45,0,0">
                        <WrapPanel>
                            <Image Source="/Bend;component/Arrow.ico" Height="117" Width="148"></Image>
                            <StackPanel Width="180">
                                <TextBlock Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="56" TextWrapping="Wrap">
                                    Bend
                                </TextBlock>
                                <TextBlock FontFamily="Segoe UI" Text="A modern text editor" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="ExtraLight"/>
                                <TextBlock Name="Version" FontFamily="Segoe UI" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="ExtraLight"/>
                            </StackPanel>
                        </WrapPanel>
                        <Label FontFamily="Segoe UI" Content="Shortcut Keys" Margin="150,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="Silver" FontSize="16" FontWeight="SemiBold"/>                        
                            <Grid Margin="150,0,0,0">
                                <Grid.ColumnDefinitions>                                    
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="2*" />
                                </Grid.ColumnDefinitions>
                                <StackPanel Grid.Column="0">
                                        <TextBlock Text="F1" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="F5" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + 0" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + C" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + F" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + G" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>    
                                        <TextBlock Text="Ctrl + H" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + Wheel" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + N" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + O" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + P" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + S" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                        <TextBlock Text="Ctrl + X" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap"/>
                                </StackPanel>
                                <StackPanel Grid.Column="1" >
                                        <TextBlock Text="Open/Close settings page" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Reload file" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Reset zoom" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />    
                                        <TextBlock Text="Copy text" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Activates find on page search box" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Goto line number" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Opens find and replace dialog" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Zoom" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="New file" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Open file" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Paste text" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />    
                                        <TextBlock Text="Save file" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                        <TextBlock Text="Cut text" Foreground="Silver" FontWeight="Regular" FontFamily="Segoe UI" FontSize="14" TextWrapping="Wrap" />
                                </StackPanel>                                    
                            </Grid>                        
                    </StackPanel>
                </Grid>
            </TabItem>
        </TabControl>        
    </Grid>
    <UserControl.Background>
        <ImageBrush ImageSource="/Bend;component/Images/SettingsPattern.png" Stretch="Fill" TileMode="Tile" Viewport="0,0,142,142" ViewportUnits="Absolute" />
    </UserControl.Background>
</UserControl>
